//
//  UIBarButtonItem+button.m
//  01 微博
//
//  Created by zhoup on 16/5/14.
//  Copyright © 2016年 zhoup. All rights reserved.
//

#import "UIBarButtonItem+button.h"
#import "UIView+Frame.h"

@implementation UIBarButtonItem (button)


+(instancetype)itemWithImage:(NSString *)imageName  hightImageName:(NSString *)hightImageName target:(id)target action:(SEL)action
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:hightImageName] forState:UIControlStateHighlighted];
    btn.size = btn.currentImage.size;
    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithCustomView:btn];
    
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return item;
}

@end
